import { defineFakeRoute } from 'vite-plugin-fake-server/client'
import { RequestHttpEnum, ResultEnum } from '@/enums/httpEnum'
import leftPageData from '@/api/data/leftPageData'
import centerPageData from '@/api/data/centerPageData'
import rightPageData from '@/api/data/rightPageData'
import {
	leftPageDataApi,
	centerPageDataApi,
	rightPageDataApi,
} from '@/api/data'

const successObject = (data: unknown) => {
	return {
		code: ResultEnum.SUCCESS,
		msg: '请求成功',
		data,
	}
}

export default defineFakeRoute([
	{
		url: leftPageDataApi,
		method: RequestHttpEnum.GET,
		response: () => successObject(leftPageData),
	},
	{
		url: centerPageDataApi,
		method: RequestHttpEnum.GET,
		response: () => successObject(centerPageData),
	},
	{
		url: rightPageDataApi,
		method: RequestHttpEnum.GET,
		response: () => successObject(rightPageData),
	},
])
